<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<script>
			(function(){
				var btn = document.querySelector("#btn");
				var img = document.querySelector("#img");
				btn.onclick = function(){
					console.log("this:",this);
					if(this.innerHTML == "开"){
						img.src = "img/亮灯.gif";
						this.innerHTML = "关";
						this.style.backgroundColor = "green";
					} else {
						img.src = "img/灭灯.gif";
						this.innerHTML = "开";
						this.style.backgroundColor = "#ddd";
					}
				}
			}())
		</script>
	</body>
</html>
